<template>
  <section>
    <el-row>
      <el-button @click="addp" type="primary" icon="plus" size="mini"></el-button>
    </el-row>
    <el-row v-for="(item, index) in value" class="fileRow">
      <el-col :span="20">
        <UploadPath v-model="item.hdfs_file_path" uploadType="1"></UploadPath>
      </el-col>
      <el-col :span="4">
        <el-button @click="delp(index)" type="primary" icon="minus" size="mini"></el-button>
      </el-col>
    </el-row>

  </section>
</template>
<script>
  //	import util from '../../common/util'
  import UploadPath from './UploadPath.vue'
  export default {
    props: {
      value: {
        //required: true,
        type: Array,
        default: function () {
          return [{
            file_id: '',
            file_name: '',
            hdfs_file_path: '/user/s',
          }]
        }
      }
    },
    components: {UploadPath},
    data() {
      return {
      }
    },
    methods: {
      setCurrentValue (value) {
        this.$emit('input', value);
        this.$emit('change', value);
      },
      addp(){
        this.value.push({
          file_id: '',
          file_name: '',
          hdfs_file_path: '',
        })
      },
      delp(index){
        this.value.splice(index, 1);
      },
    },
    mounted () { }
  }
</script>

<style scoped>
  .fileRow{
    margin-bottom: 5px;
  }
</style>